package apache.openejb.session.bean.stateful;

import java.net.InetAddress;
import java.net.UnknownHostException;

import javax.ejb.Stateful;

@Stateful
public class AccountImpl implements AccountRemote {
    private double balance = 0;
    
    public void deposit(double amount) {
        balance += amount;
    }
    
    public void withdraw(double amount) {
        balance += amount;
    }
    
    public String result(String msg) {
        String hostname = null;
        try {
            hostname = InetAddress.getLocalHost().getHostName();
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }

        return msg + ", and balance is " + balance + " at " + hostname;
    }
}
